package cc.facesign.acl.controller;


import cc.facesign.acl.bean.AclRole;
import cc.facesign.acl.service.TblUserService;
import cc.facesign.acl.utils.GaineUtils;
import cc.facesign.common.utils.bean.R;
import cc.facesign.servicebase.utils.RedisCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author acdongla
 * @since 2022-05-02
 */
@RestController
@RequestMapping("/acl/user")
@Api(description = "用户相关")
public class TblUserController {

    @Autowired
    private TblUserService userService;

    @Autowired
    private RedisCache redisCache;

    @Autowired
    private GaineUtils gaineUtils;

    @ApiOperation("获取该用户所有角色")
    @GetMapping("/getRolesByUserId/{userId}")
    public R getRolesByUserId(@PathVariable String userId) {

        List<AclRole> list= userService.getAllRolesByUserId(userId);

        return R.ok().data("data", list);
    }

}

